React Testing Library
インストール
$ npm i -D @testing-library/react
$ npm i -D @testing-library/jest-dom
$ npm i -D @testing-library/user-event
clickとかtypeとかいろいろ使えるようになる
renderのdoc
要素選択クエリのdoc
getBy*, queryBy*など
jest-dom
DOMをテストするjestマッチャー
使用できるマッチャーの一覧
Testing Trophy
static
unitの下に静的チェックされる
confidence coefficient
実装の詳細をテストせず、ユーザ目線でテストする
vs Enzymeって感じrmaruon.icon
data-testid
ビルド時にdata-testid属性が取り除かれるように設定する
Using data-testid attributes do not resemble how your software is used and should be avoided if possible.
公式的には非推奨
ref